import requests
try:
    url_list = ["http://www.bspider.top/static/yh31/images/202103302056530751.gif",
                "http://www.bspider.top/static/yh31/images/202103182029425871.jpg"]
    for url in url_list:
        r=requests.get(url,timeout=3)
        dir="d:\\"
        file_name=url.split("/")[-1:][0]
        file_name=dir+file_name
        with open(file_name,"wb+")as f:
            f.write(r.content)
except Exception as err:
    print(err)
import requests
def get_image(url):
    try:
        r=requests.get(url,timeout=10)
        r.raise_for_status()
        return r.content
    except Exception as err:
        print(err)
def save_imag(path,content):
    with open(path,"wb")as f:
        f.write(content)
if __name__ == '__main__':
    url_list = ["http://www.bspider.top/static/yh31/images/202103302056530751.gif",
                "http://www.bspider.top/static/yh31/images/202103182029425871.jpg"]
    for url in url_list:
        imag_content=get_image(url)
        dir = "d:\\表情包\\"
        file_name = url.split("/")[-1:][0]
        file_name = dir + file_name
        save_imag(file_name,imag_content)